import Layout from '@/pages/layout'
import Login from '@/pages/login'
import Test from '@/pages/test'
import Detail from '@/pages/detail'
import Search from '@/pages/search'
import SearchResult from '@/pages/search/result'
import Chat from '@/pages/chat'

// 导入子页面
import Home from '@/pages/home'
import Question from '@/pages/question'
import Video from '@/pages/video'
import Profile from '@/pages/profile'
import Edit from '@/pages/profile/Edit'
import Auth from '@/components/auth'

const routes = [
  // 公共布局页面
  {
    path: '/',
    element: <Layout />,
    children: [
      {
        path: '/',
        element: <Home />,
      },
      {
        path: '/question',
        element: <Question />,
      },
      {
        path: '/video',
        element: <Video />,
      },
      {
        path: '/profile',
        element: <Auth element={<Profile />} />,
      },
    ],
  },
  // 小智聊天
  {
    path: '/chat',
    element: <Chat />,
  },
  // 搜索
  {
    path: '/search',
    element: <Search />,
  },
  // 搜索结果
  {
    path: '/search/result',
    element: <SearchResult />,
  },
  // 文章详情
  {
    path: '/article/:id',
    element: <Detail />,
  },
  // 修改个人信息
  {
    path: '/profile/edit',
    element: <Auth element={<Edit />} />,
  },
  // 登录
  {
    path: '/login',
    element: <Login />,
  },
  {
    path: '/test',
    element: <Test />,
  },
]

export default routes
